<?php

namespace App\Repository\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;

/**
 * Class OrderProductComment.
 *
 * @package namespace App\Repository\Models;
 */
class OrderProductComment extends Model implements Transformable
{
    use TransformableTrait;
    use SoftDeletes;

    protected $table = 'order_product_comment';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['user_id', 'order_code', 'order_product_id', 'product_id', 'sku_id', 'product_comment', 'seller_comment', 'logistics_comment', 'overall', 'comment', 'check_status', 'remark'];

    public static $check_status = [
        1 => '未审核',
        2 => '审核通过',
        3 => '审核不通过'
    ];

    public function product()
    {
        return $this->hasOne(Products::class, 'id', 'product_id');
    }
    
    public function productSku()
    {
        return $this->hasOne(ProductSkus::class, 'id', 'sku_id');
    }

    public function user()
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }

    public function orderProduct()
    {
        return $this->hasOne(OrderProducts::class, 'product_id', 'product_id');
    }
}
